package com.lagou.util;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

public class JDBCUtils {

    // 创建连接池对象 dataSource对象
    private static DataSource dataSource = new ComboPooledDataSource();

    // 定义获取连接池对象的方法
    public static DataSource getDataSource() {
        return dataSource;
    }

    // 定义获取Connection对象的方法
    public static Connection getConnection() throws SQLException {
        return dataSource.getConnection();
    }

}
